import xlrd

class Readxls(object):
    def __init__(self,filename=r"E:\woniu\woniusales_ui_test_ddt\data\ddt_testwoniusales.xls",sheet='Sheet1'):
        self.file = filename
        self.sheet = sheet
        self.list = []
    def read_datas(self):
        wb = xlrd.open_workbook(self.file)
        mysheet = wb.sheet_by_name(self.sheet)
        for r in range(mysheet.nrows):
            r_values = mysheet.row_values(r)  # 取行数据，参数0为第一行。
            if r != 0:
                a = dict(zip(mysheet.row_values(0), r_values))
                self.list.append(a)
        return self.list

# class ReadCsv():
#     def __init__(self,filename=r"E:\woniu\woniusales_ui_test_ddt\data\ddt_testwoniusales.xls"):
#         self.file = filename
#
#     def read_data(self):
#         with open(self.file,'a') as f:
#             f


if __name__ == '__main__':
    r1=Readxls()
    print(r1.read_datas())